﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="FillCartridgeBBB.Models" %>

<table>
        <tr>
            <th></th>
                        <th>
				Принтер
            </th>
            <th>
				Назва картриджа
            </th>
            <th>
                Серійний номер
            </th>

            <th>
                Стан
            </th>
        </tr>

    <% foreach (var item in (IEnumerable<Cartridge>)ViewData.Eval("Cartridges"))
       { %>
    
        <tr>
        <% if (ReferenceEquals(ViewData["Type"], "Edit"))
{%>
        <td>
                <%=Html.ActionLink("Edit", "Edit", new {id = item.CartridgeId})%> |
                <%=Html.ActionLink("Delete", "Delete", new {id = item.CartridgeId},
                                      new {Onclick = "return confirm ('Ви впевнені?')"})%>
                </td>
                <%} else if (ReferenceEquals(ViewData["Type"], "Select")) {%>
              <td>
                <input type="checkbox" name="CartridgeId" value="<%=item.CartridgeId %>"/>
              </td>  
            <%}%>
            <td>            
				<%=Html.ActionLink(item.Printer.PrinterName, "Details", "Printer", new {id=item.Printer.PrinterId}, null)%>
            </td>
            <td>
            <%= Html.Encode(item.Printer.CartridgeName) %>              
            </td>
            <td>
                <%= Html.Encode(item.SerialNumber) %>
            </td>

            <td>
                <%= Html.Encode(item.State.StateName) %>
            </td>
        </tr>
    
    <% } %>

    </table>